package com.rental.web.controller;

import com.rental.common.result.AjaxResult;
import com.rental.web.service.CosService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Tag(name = "COS模块")
@RequestMapping("/cos")
public class CosController {

    @Autowired
    private CosService cosService;

    @Operation(summary = "上传文件")
    @PostMapping("/upload")
    public AjaxResult<String> upload(@RequestPart("file") MultipartFile file, @RequestParam(required = false, defaultValue = "images") String path){
        return cosService.upload(file,path);
    }
}
